#include <QtGui>
#include <QtCore/QTextCodec>
#include <QTranslator>
#include "gv_setuphomedialog.h"
#include "gv_setupchangepwddiaglog.h"
#include "gv_setuplanguagedialog.h"
#include "gv_setuptimedialog.h"
#include "gv_monitormodedialog.h"
#include "gv_monitorerrorlogdialog.h"
#include "gv_monitorhistorydialog.h"
#include "gv_monitorsystemdialog.h"
#include "gv_home.h"
#include "gv_setting.h"

extern GV_Setting *gvsetting;
extern QDialog  *dialog;
GV_MonitormodeHomeDialog::GV_MonitormodeHomeDialog(QWidget *parent)
       : QDialog(parent)
{
    setupUi(this);

    QTranslator translator;
    translator.load(gvsetting->GV_GetLanguage(),".");
    qApp->installTranslator(&translator);
    reloadtext();

    TimeHintsLabel->setText((QDateTime::currentDateTime().toString("hh:mm:ss")));
    DateHintsLabel->setText((QDateTime::currentDateTime().toString("yyyy-MM-dd")));
    timer = new QTimer;
    connect(timer,SIGNAL(timeout()),this,SLOT(GV_chTime()));
    connect(BackButton,SIGNAL(clicked()),this,SLOT(home()));
    connect(CancelButton,SIGNAL(clicked()),this,SLOT(home()));

    connect(HistoryButton,SIGNAL(clicked()),this,SLOT(history()));
    connect(SystemButton,SIGNAL(clicked()),this,SLOT(system()));
    connect(ErrorButton,SIGNAL(clicked()),this,SLOT(errorlog()));

    connect(ServiceButton,SIGNAL(clicked()),this,SLOT(system()));
    connect(e1AlarmButton,SIGNAL(clicked()),this,SLOT(errorlog()));
    connect(e2AlarmButton,SIGNAL(clicked()),this,SLOT(errorlog()));
    connect(e3AlarmButton,SIGNAL(clicked()),this,SLOT(errorlog()));

    timer->start(1000);
}
void GV_MonitormodeHomeDialog::reloadtext()
{
    //NameHintsLabel->setText(tr("Zones"));
}
void GV_MonitormodeHomeDialog::GV_chTime()
{
    TimeHintsLabel->setText((QDateTime::currentDateTime().toString("hh:mm:ss")));
    DateHintsLabel->setText((QDateTime::currentDateTime().toString("yyyy-MM-dd")));
}

void GV_MonitormodeHomeDialog::home()
{
    QDialog *dialog1 = new gv_home;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}

void GV_MonitormodeHomeDialog::history()
{
    QDialog *dialog1 = new GV_MonitormodeHistoryDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}
void GV_MonitormodeHomeDialog::system()
{
    QDialog *dialog1 = new GV_MonitormodeSystemDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}
void GV_MonitormodeHomeDialog::errorlog()
{
    QDialog *dialog1 = new GV_MonitormodeErrorlogDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}


